//
//  SubCateViewController.m
//  ExpansionTableViewByZQ
//
//  Created by 郑 琪 on 13-2-27.
//  Copyright (c) 2013年 郑 琪. All rights reserved.
//

#import "SubCateViewController.h"
#import "UIFolderTableView.h"
#import "UILabel+quicksetting.h"
#import "UIButton+QuickSettings.h"

@interface SubCateViewController ()
@property (strong, nonatomic) IBOutlet UILabel *label_Info;
@end

@implementation SubCateViewController

//-(void)DisplayInfo:(NSString *)info
//{
//    self.label_Info.numberOfLines = 0;
//    CGSize size = [self.info sizeWithFont:self.label_Info.font constrainedToSize:CGSizeMake(320, MAXFLOAT)];
//    [self.label_Info setFrame:CGRectMake(0, 0, 320, size.height)];
//    [self.view setFrame:CGRectMake(0, 0, 320, size.height)];
//    self.label_Info.text = self.info;
//}


#pragma ViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)size:(CGSize)size Label:(NSString *)labelTitle button:(NSString *)buttonTitle tag:(NSInteger)tag{
    
    if (labelTitle || buttonTitle) {
        [self.view setFrame:CGRectMake(0, 0, 320, size.height + 30)];
        [self.label_Info setFrame:CGRectMake(80, 0, size.width, size.height)];
        UILabel *label = [UILabel labelWithFrame:CGRectMake(80, size.height, 70, 30) title:labelTitle fontColor:[UIColor lightGrayColor] fontSize:14];
        UIButton *button = [UIButton buttonWithTag:tag frame:CGRectMake(150, size.height, 120, 30) title:buttonTitle fontSize:14 color:APPCOLOR target:self.vc action:@selector(buttonClicked:)];
        [self.view addSubview:label];
        [self.view addSubview:button];
    }else{
        [self.view setFrame:CGRectMake(0, 0, 320, size.height)];
        [self.label_Info setFrame:CGRectMake(80, 0, size.width, size.height)];
    }
}

- (void)buttonClicked:(UIButton *)sender{
    
}

- (void)viewDidLoad{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    self.label_Info.numberOfLines = 0;
    self.label_Info.text = self.info;
    CGSize size = [self.info sizeWithFont:self.label_Info.font constrainedToSize:CGSizeMake(self.label_Info.frame.size.width, 500) lineBreakMode:NSLineBreakByCharWrapping];
    if(size.height < self.label_Info.frame.size.height)
    {
        size = CGSizeMake(self.label_Info.frame.size.width, self.label_Info.frame.size.height);
    }
    
    switch (self.tag) {
        case 0:{
            [self size:size Label:@"相关工具：" button:@"购房资格测试" tag:0];
            break;
        }
        case 1:{
            [self size:size Label:@"相关工具：" button:@"购房能力评估" tag:1];
            break;
        }
        case 2:{
            [self size:size Label:@"详细参考：" button:@"看房选房" tag:2];
            break;
        }
        case 3:{
            [self size:size Label:nil button:nil tag:3];
            break;
        }
        case 4:{
            [self size:size Label:@"相关工具：" button:@"购房资格测试" tag:4];
            break;
        }
        case 5:{
            [self size:size Label:nil button:nil tag:5];
            break;
        }
        case 6:{
            [self size:size Label:@"详细参考" button:@"公积金贷款" tag:6];
//            UIButton *button = [UIButton buttonWithTag:12 frame:CGRectMake(150, size.height, 120, 30) title:@"商贷办理" fontSize:14 color:APPCOLOR target:self.vc action:@selector(buttonClicked:)];
//            [self.view addSubview:button];
            break;
        }
        case 7:{
            [self size:size Label:nil button:nil tag:7];
            break;
        }
        case 8:{
            [self size:size Label:nil button:nil tag:8];
            break;
        }
        case 9:{
            [self size:size Label:@"详细参考" button:@"买房税费" tag:9];
            break;
        }
        case 10:{
            [self size:size Label:nil button:nil tag:10];
            break;
        }
        case 11:{
            [self size:size Label:nil button:nil tag:11];
            break;
        }
        default:
            break;
    }
    
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
